package cn.kimming.wms.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Set;

import com.opensymphony.xwork2.ActionContext;

import cn.kimming.wms.domain.Employee;

public class UserContext {
	private UserContext() {}
	
	/**
	 * 将用户存入session 
	 */
	public static void putUser(Employee user) {
		ActionContext.getContext().getSession().put("user_in_session", user);
	}
	
	/**
	 * 从session中获取当前用户
	 */
	public static Employee getUser() {
		return (Employee)ActionContext.getContext().getSession().get("user_in_session");
	}
	
	/**
	 * 将用户权限列表存入session
	 */
	public static void putPemissions(Set<String> permissionSet) {
		ActionContext.getContext().getSession().put("permissions_in_session", permissionSet);
	}
	
	/**
	 * 从session中取出用户权限列表
	 */
	public static Set<String> getPemissions() {
		return (Set<String>)ActionContext.getContext().getSession().get("permissions_in_session");
	}
}
